<cfcomponent extends="Controller">

<cffunction name="CheckSession">
<cfif not isdefined("SESSION.qadmin") OR SESSION.qadmin NEQ 1>
<cfset redirectTo(action="index")>
</cfif>
</cffunction>
	
<cffunction name="index">
<cfset contentFor(pageTitle="Paul Ferrare")>
<cfset contentFor(head='<link href="../stylesheets/general.css" rel="stylesheet" type="text/css" />')>
<cfset contentFor(head='<link href="stylesheets/general.css" rel="stylesheet" type="text/css" />')>
<cfset usesLayout("../layout")>
<cfif isdefined('SESSION.qadmin')>
<cfwindow center="true" closable="true" draggable="true" modal="true" resizable="true" initshow="true" refreshonshow="false" height="300" name="image" source="../files/#SESSION.clientP#" title="#SESSION.client#" width="1000" destroyonclose="true" headerstyle="background-color: ##033;color: ##FFFFFF;padding-left:6px;">
</cfwindow>
<cfset logout=StructClear(session)>
</cfif>
</cffunction>

<cffunction name="login">
<cfparam name="params.username" default="1">
<cfparam name="params.password" default="1">
<cfset client = model("clients").findAllByClientUsernameAndClientPassword("#params.username#,#params.password#")>
<cfif client.recordcount GT 0>
        <cfset SESSION.qadmin=1>
		<cfset SESSION.client=client.clientName>
		<cfset SESSION.clientP=client.clientPage>
        <cfset redirectTo(action="index")>
        <cfelse>
        <cfset redirectTo(action="index", params="login=false")>
</cfif>
</cffunction>

<cffunction name="details">
<cfset check=CheckSession()>
<cfset client = model("clients").findAll(where="clientName='#SESSION.client#'")>	
<cfset contentFor(pageTitle="#client.clientName#")>
<cfset contentFor(head='<link href="../stylesheets/general.css" rel="stylesheet" type="text/css" />')>
</cffunction>

<!--- <cffile action="read" file="#expandpath('files/#client.clientPage#')#" variable="thisFile">
<cfwindow center="true" closable="true" draggable="true" modal="true" resizable="true" initshow="true" refreshonshow="false" height="300" name="image" source="../files/#client.clientPage#" title="#client.clientName#" width="900" destroyonclose="false">
</cfwindow> --->

</cfcomponent>